/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package propres;
import java.util.*;
/**
 *
 * @author neochange
 */
public class CtrlVistaplato {

    private CtrlDominioplato driver;
    
        
    public CtrlVistaplato(CtrlVistalimento B)
    {
    try{    
    driver = new CtrlDominioplato(B.get_Ctrldom());
    }
    catch(Exception e){System.out.println("Error:"+e.getMessage());}
    }
    
    public CtrlDominioplato get_contrlDom(){
    return driver;
    }
    
    
    public List<String> gestion_evento(String acc, String no,String[] als) throws Exception{
    
    List<String> B = new ArrayList();    
        
    if(acc.equals("Añadir plato")){
    driver.intplato(no,als);
    }
    else if(acc.equals("Modificar plato")){
    driver.modplato(no,als);
    }
    else if(acc.equals("Consultar plato")){
    B = driver.consplato(no);
    }
    else if(acc.equals("Eliminar plato")){
    driver.eliplato(no);
    }
    else if(acc.equals("Consultar platos")){
    B =driver.listplato();
    }
    
    return B;
    
    }
    
    public List<String> listalim(String tip)
    {
    List<String> g = new ArrayList();
    
    g=driver.listali(tip);    
    
    return g;
    } 

    public void guardar_objeto(String path) throws Exception
    {
    
    driver.guardar(path);
    }
    
    public void cargar_objeto(String path) throws Exception
    {
    
    driver.cargar(path);
    }
    
}